<script>
	export default {
		onLaunch: function() {
			console.log('App Launch')
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		mounted(){
			// 创建脚本元素
			const script = document.createElement('script');
			script.src = './static/js/translate.js';
			
			// 加载后初始化翻译
			script.onload = () => {
			  if (typeof translate !== 'undefined') {
				translate.language.setLocal('chinese_simplified');
				translate.listener.start();
				translate.execute();
				translate.service.use('client.edge');
				// 解决页面动态内容翻译问题
				this.$nextTick(() => {
				  setTimeout(() => translate.execute(), 500);
				});
			  }
			};
			
			// 添加到body底部
			document.body.appendChild(script);
		}
	}
</script>

<style lang="scss">
	/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
	@import "@/uni_modules/uview-ui/index.scss";
</style>